<?
require("config.php");

$location_status .= "| Add";
$show_backnav = "product_menu";
$menutype = 2;

if (NULL!=$action){
   $field = array(
	"code",
	"name",
	"description",
	"unit",
	"brand",
	"type",
	"category",
	"fabric",
	"price_euro",
	"price_gbp",
	"price_hkd",
	"price_usd",
	"remark",
	);


   $content = array(
	$Code,
	$Name,
	$Description,
	$Unit,
	$Brand,
	$Type,
	$Category,
	$Fabric,
	$Euro,
	$Gbp,
	$Hkd,
	$Usd,
	$Remarks,
	);

   myInsert($table,$field,$content);


   header("location:" . $rela_path . "share/msg.php?v=1");

   exit();

}

if (checkCode($table,$Code)){

	header("location:" . $rela_path . "share/msg.php?v=9001");
	exit();
}


$Query = "select code, name from pro_brand";
$brands = myQuery($Query);

$Query = "select code, name from pro_type";
$types = myQuery($Query);


$Query = "select code, name from pro_category";
$categorys = myQuery($Query);


require($rela_path . "inc/header.php");

?>
<form action="" method="post" name="form1">                    <table width="95%" border="0" align="center">
                      <tr> 
                        
      <td align="right">
	  
	  <input type="image" src="../../images/bt_cancel.gif" width="78" height="23" onclick="Redirect('product_menu.php',1);return false;"> 
        <input type="image" src="../../images/bt_save.gif" width="76" height="22"  <?print($active)?>> 


      </td>
                      </tr>
                    </table>
                    <table width="95%" border="0" align="center">
                      <tr> 
                        <td align="right">&nbsp; </td>
                      </tr>
                      <tr> 
                        <td><table border="0" cellspacing="0" cellpadding="2">
                            <tr> 
                              <td>&nbsp;</td>
                              <td>&nbsp;</td>
                            </tr>
                            <tr> 
                              <td>Code :</td>
                              <td> <input type="text" class="text" name="Code" value="<?print($Code)?>" DISABLED> 
							  
							  






<!--hidden filed-->
<input name="action" type="hidden" value="add">
<input name="Code" type="hidden" value="<?print($Code)?>">


							  
							  
							  
							  
							  </td>
                            </tr>
                            <tr> 
                              <td>Name :</td>
                              <td> <textarea class="text" name="Name" cols="40" rows="2"  <?print($active)?>><?print($Name)?></textarea> 
                              </td>
                            </tr>
                            <tr> 
                              <td>Description :</td>
                              <td> <textarea class="text" name="Description" cols="40" rows="5"  <?print($active)?>><?print($Description)?></textarea> 
                              </td>
                            </tr>
                            <tr> 
                              <td>Unit :</td>
                              <td>
							  
<select class="select" name="Unit"  <?print($active)?>>
<?

$units = array(
  "PC",
  "DZ",
  "PAIR",
  "BOX",
  );

for ($i=0;$i<count($units);$i++){
	print("<option value=" . $units[$i] . ">" . $units[$i] . "</option>");
}

?>
</select> 							  

								
								
								
								</td>
                            </tr>
                            <tr> 
                              <td>Brand :</td>
                              <td> 


<select class="select" name="Brand"  <?print($active)?>>
<?
for ($i=0;$i<count($brands);$i++){
	print("<option value=\"" . $brands[$i][1] . "\">" . $brands[$i][1] . "</option>");
}

?>
</select> 


</td>
                            </tr>
                            <tr>
                              <td>Type :</td>
                              <td> 

<select class="select" name="Type"  <?print($active)?>>
<?
for ($i=0;$i<count($types);$i++){
	print("<option value=" . $types[$i][1] . ">" . $types[$i][1] . "</option>");
}

?>
</select> 
							  

								
								</td>
                            </tr>
                            <tr> 
                              <td>Category :</td>
                              <td> 
							  
<select class="select" name="Category"  <?print($active)?>>
<?
for ($i=0;$i<count($categorys);$i++){
	print("<option value=" . $categorys[$i][1] . ">" . $categorys[$i][1] . "</option>");
}

?>
</select> 



								
								
								
								</td>
                            </tr>
                            <tr> 
                              <td>Fabric :</td>
                              <td> <textarea class="text" name="Fabric" cols="40" rows="5"  <?print($active)?>><?print($Fabric)?></textarea> 
                              </td>
                            </tr>
                            <tr> 
                              <td>Price : </td>
                              <td> <input type="text" class="text" name="Euro" size="10"  value=<?print($Price_euro)?>  <?print($active)?>>
                                EURO<br> 
<input type="text" class="text" name="Gbp" size="10" value=<?print($Price_gbp)?>  <?print($active)?>>
                                GBP<br>
<input type="text" class="text" name="Hkd" size="10" value=<?print($Price_hkd)?>  <?print($active)?>>
                                HKD<br> 
<input type="text" class="text" name="Usd" size="10" value=<?print($Price_usd)?>  <?print($active)?>>
                                USD <br> </td>
                            </tr>
                            <tr> 
                              <td>Remarks :</td>
                              <td> <textarea class="text" name="Remarks" cols="40" rows="5"  <?print($active)?>><?print($Remark)?></textarea> 
                              </td>
                            </tr>
                            <tr> 
                              <td>&nbsp;</td>
                              <td>&nbsp;</td>
                            </tr>
                          </table></td>
                      </tr>
                    </table>
                    <table width="95%" border="0" align="center">
                      <tr> 
                        
      <td align="right">
	  
	  <input type="image" src="../../images/bt_cancel.gif" width="78" height="23" onclick="Redirect('product_menu.php',1);return false;"> 
        <input type="image" src="../../images/bt_save.gif" width="76" height="22" <?print($active)?>> 


      </td>
                      </tr>
                    </table>
                  </form>
            <!--Content End-->
            <?
require($rela_path . "inc/footer.php");
?>
        